#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    int num, *list;
    while (scanf("%d", &num) != EOF) {
        if (num == 0) 
            break;
        list = (int*)malloc(sizeof(int) * num);
        for (int i = 0; i < num; i++) 
            scanf(" %d", &list[i]);
        int target, offset = -1;
        scanf(" %d", &target);
        for (int i = 0; i < num; i++) 
            if (list[i] == target) 
                offset = i;
        printf("%d\n", offset);
        free(list);
    }
    
    return 0;
}